<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>动态绑定外部样式类——对象数组语法</title>
    <style>
        .active {
            background-color: chocolate;
        }

        .line {
            text-decoration: underline;
        }
    </style>
</head>
<body>
<div id="app">
    <!--问题：如果使用 v-bind 绑定多个外部样式类，只有第一个生效-->
    <h1 v-bind:class="isActiveObject" v-bind:class="isLineObject">Hello, Vue</h1>
    <h1 v-bind:class="isLineObject" v-bind:class="isActiveObject">Hello, Vue</h1>


    <!--使用数据对象-->
    <h1 v-bind:class="[isLineObject, isActiveObject]">Hello, Vue</h1>

    <!--直接使用 外部样式类字符串 -->
    <h1 v-bind:class="['active', 'line']">Hello, Vue</h1>

</div>

<script type="module">
    import {createApp, ref, reactive} from "../../../js/vue.esm-browser.js";

    let app = createApp(
        {
            setup() {
                let isActive = ref(true)
                let isLine = ref(true)

                let isActiveObject = reactive({active: isActive})
                let isLineObject = reactive({line: isLine})

                return {
                    isActive, isLine,
                    isActiveObject, isLineObject,
                }
            }
        }
    );

    app.mount("#app")
</script>
</body>
</html>